define("component/main/UserInfo", ["vuex", "text!./UserInfo.html"], function(
  { mapState, mapActions },
  template
) {
  return {
    template: template,
    name: "UserInfo",
    props: {
      userAvator: {
        type: String,
        default: ""
      }
    },
    methods: {
      ...mapActions(["handleLogOut"]),
      handleClick(name) {
        switch (name) {
          case "logout":
            this.handleLogOut().then(() => {
              location.reload();
            });
            break;
        }
      }
    },
    computed: {
      ...mapState({ userName: state => state.userName })
    }
  };
});
